import { createRouter, createWebHistory } from "vue-router";
const routes = [
    {
        path: "/admin/login",
        name: "AdminLogin",
        component: () => import("../views/admin/Login.vue"),
    },
    {
        path: "/admin",
        name: "AdminHome",
        component: () => import("../views/admin/Home.vue"),
        redirect: '/admin/orderManager',
        children: [
            {
                path: "/admin/customerManager",
                name: "AdminCustomerManager",
                meta: {
                    title: '用户管理'
                },
                component: () => import("../views/admin/CustomerManager.vue"),
            },
            {
                path: "/admin/filesManager",
                name: "AdminFilesManager",
                meta: {
                    title: '文件管理'
                },
                component: () => import("../views/admin/FilesManager.vue"),
            },
          
           
            {
                path: "/admin/orderManager",
                name: "AdminOrderManage",
                meta: {
                    title: '订单管理'
                },
                component: () => import("../views/admin/OrderManage.vue"),
            },

            {
                path: "/admin/classifyManager",
                name: "ClassifyManager",
                meta: {
                    title: '分类管理'
                },
                component: () => import("../views/admin/ClassifyManager.vue"),
            },
            {
                path: "/admin/flavorManager",
                name: "FlavorManager",
                meta: {
                    title: '口味管理'
                },
                component: () => import("../views/admin/FlavorManager.vue"),
            },
            {
                path: "/admin/crowdManager",
                name: "CrowdManager",
                meta: {
                    title: '人群管理'
                },
                component: () => import("../views/admin/CrowdManager.vue"),
            },
            {
                path: "/admin/cakeManager",
                name: "CakeManager",
                meta: {
                    title: '蛋糕管理'
                },
                component: () => import("../views/admin/CakeManage.vue"),
            },
            {
                path: "/admin/addCakeManage",
                name: "AddCakeManage",
                meta: {
                    title: '新增蛋糕'
                },
                component: () => import("../views/admin/AddCakeManage.vue"),
            },
        ]
    },
    {
        path: "/",
        name: "PCHome",
        component: () => import("../views/cake/Home.vue"),
        redirect: 'index',
        children: [
            {
                path: "",
                name: "PCIndex",
                meta: {
                    title: '首页'
                },
                component: () => import("../views/cake/Index.vue"),
            },
            {
                path: "/classifyList",
                name: "PCClassifyList",
                meta: {
                    title: '蛋糕分类'
                },
                component: () => import("../views/cake/ClassifyList.vue"),
            },
            {
                path: "/cakeDetail",
                name: "PCCakeDetail",
                meta: {
                    title: '蛋糕详细'
                },

                
                component: () => import("../views/cake/CakeDetail.vue"),
            },
            {
                path: "/cart",
                name: "PCCart",
                meta: {
                    title: '购物车'
                },
                component: () => import("../views/cake/Cart.vue"),
            },
            {
                path: "/order",
                name: "PCOrder",
                meta: {
                    title: '订单管理'
                },
                component: () => import("../views/cake/Order.vue"),
            },
            {
                path: "/login",
                name: "PCLogin",
                meta: {
                    title: '登录'
                },
                component: () => import("../views/cake/Login.vue"),
            },
            {
                path: "/customerCenter",
                name: "PCCustomerCenter",
                meta: {
                    title: '个人中心'
                },
                component: () => import("../views/cake/CustomerCenter.vue"),
            },
        ]
    },
];

const router = createRouter({
    history: createWebHistory("/"),
    routes,
});

export default router;